package com.example.demo.model;

import com.example.demo.dataobject.PaymentRecordDO;

import java.time.LocalDateTime;

/**
 * 支付流水记录模型
 */
public class PaymentRecord {
    private String id; // 主键id
    private String userId; // 用户id
    private String orderNumber; // 订单号
    private String channelPaymentId; // 外部支付渠道主键id
    private String channelType; // 渠道类型
    private Double amount; // 支付金额
    private PayType payType; // 支付类型
    private PaymentStatus payStatus; // 支付状态
    private String extendStr; // 订单额外信息
    private String payEndTime; // 支付完成时间
    private LocalDateTime gmtCreated; // 创建时间
    private LocalDateTime gmtModified; // 结束时间

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getChannelPaymentId() {
        return channelPaymentId;
    }

    public void setChannelPaymentId(String channelPaymentId) {
        this.channelPaymentId = channelPaymentId;
    }

    public String getChannelType() {
        return channelType;
    }

    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public PayType getPayType() {
        return payType;
    }

    public void setPayType(PayType payType) {
        this.payType = payType;
    }

    public PaymentStatus getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(PaymentStatus payStatus) {
        this.payStatus = payStatus;
    }

    public String getExtendStr() {
        return extendStr;
    }

    public void setExtendStr(String extendStr) {
        this.extendStr = extendStr;
    }

    public String getPayEndTime() {
        return payEndTime;
    }

    public void setPayEndTime(String payEndTime) {
        this.payEndTime = payEndTime;
    }

    public LocalDateTime getGmtCreated() {
        return gmtCreated;
    }

    public void setGmtCreated(LocalDateTime gmtCreated) {
        this.gmtCreated = gmtCreated;
    }

    public LocalDateTime getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(LocalDateTime gmtModified) {
        this.gmtModified = gmtModified;
    }

    /**
     * 模型转换成数据库对象
     * @return PaymentRecordDO支付记录数据库对象
     */
    public PaymentRecordDO toDO() {
        PaymentRecordDO paymentRecordDO = new PaymentRecordDO();
        paymentRecordDO.setId(id);
        paymentRecordDO.setUserId(Long.valueOf(userId));
        paymentRecordDO.setOrderNumber(orderNumber);
        paymentRecordDO.setChannelPaymentId(channelPaymentId);
        paymentRecordDO.setChannelType(channelType);
        paymentRecordDO.setAmount(amount);
        paymentRecordDO.setPayType(String.valueOf(payType));
        paymentRecordDO.setPayStatus(String.valueOf(payStatus));
        paymentRecordDO.setExtendStr(extendStr);
        paymentRecordDO.setPayEndTime(payEndTime);
        paymentRecordDO.setGmtCreated(gmtCreated);
        paymentRecordDO.setGmtModified(gmtModified);
        return paymentRecordDO;
    }
}
